
package com.primeton.eos.oss.model.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.eos.system.utility.PageResultList;

import com.eos.data.datacontext.DataContextManager;
import com.eos.data.datacontext.IMUODataContext;

import com.primeton.eos.oss.model.dao.AfcROrgPositionDao;
import com.primeton.eos.oss.model.newdataset.AfcROrgPosition;

@Service
public class AfcROrgPositionService {

    @Autowired
    private AfcROrgPositionDao afcROrgPositionDao;


    public PageResultList<AfcROrgPosition> queryAfcROrgPositionsWithPage(String id,  int pageSize, int pageIndex) {
        //TODO 记录日志
        return afcROrgPositionDao.queryAfcROrgPositionsWithPage(id,  pageSize, pageIndex);
    }

    public AfcROrgPosition getAfcROrgPositionById(String id) {
        //TODO 记录日志
        return afcROrgPositionDao.getEntity(AfcROrgPosition.QNAME, id);
    }

    @Transactional
    public void createAfcROrgPosition(AfcROrgPosition afcROrgPosition) {
        //TODO 记录日志
    	String userName = "";
		IMUODataContext muo = DataContextManager.current().getMUODataContext();
		if (muo != null) {
			userName = muo.getUserObject().getUserName();
		}
        afcROrgPosition.set("createUser", userName);
        afcROrgPosition.set("createTime", new Date());
        afcROrgPosition.set("updateUser", userName);
        afcROrgPosition.set("updateTime", new Date());

        afcROrgPositionDao.getPrimaryKey(afcROrgPosition);
        afcROrgPositionDao.insertEntity(afcROrgPosition);
    }
    
    @Transactional
    public void modifyAfcROrgPosition(AfcROrgPosition afcROrgPosition) {
        //TODO 记录日志
     	String userName = "";
		IMUODataContext muo = DataContextManager.current().getMUODataContext();
		if (muo != null) {
			userName = muo.getUserObject().getUserName();
		}
        afcROrgPosition.set("updateUser", userName);
        afcROrgPosition.set("updateTime", new Date());
 
        afcROrgPositionDao.updateEntity(afcROrgPosition);
    }
    
     @Transactional
    public void removeAfcROrgPosition(AfcROrgPosition[] afcROrgPosition) {
        //TODO 记录日志
        afcROrgPositionDao.deleteEntity(afcROrgPosition);
    }

}





